extends BTCondition

func _tick(_delta: float) -> Status:

	var unit = agent as Unit
	var current_target = unit.current_target
	var min_range = unit.min_attack_range
	# 防御性检查
	if not is_instance_valid(current_target) or min_range <= 0:
		return Status.FAILURE

	
	if not is_instance_valid(unit):
		return Status.FAILURE
	

	if unit.in_attack_range():
		return Status.SUCCESS

	return Status.FAILURE
